< previous page page_897 next page >

Page 897
Type.gifListing A.23. Coding the ShowTable routine.
Sub ShowTable(cSQL As String, strDB As String)
    '
    ' show a selected table
    '
    strGlobalSelect = strSQLLine
    strGlobalDBName = strDB
    '
    intForms = intForms + 1
    ReDim Preserve TblForms(intForms) As Form
    Set TblForms(intForms) = New SQLVBChild
    Load TblForms(intForms)
    TblForms(intForms).Caption = CStr(intForms)
    TblForms(intForms).Data1.DatabaseName = strGlobalDBName
    TblForms(intForms).Data1.RecordSource = strGlobalSelect
    TblForms(intForms).Data1.Refresh
    TblForms(intForms).Show
    TblForms(intForms).WindowState = vbMinimized
    TblForms(intForms).WindowState = vbNormal
    '
End Sub
The only fancy stuff in this module involves the creation of new Form objects. Remember that you created a global array called TblForms in the declaration section of the module? This routine increases the size of the array by 1 each time it is invoked. Also, this routine uses the Visual Basic SET command to create a new instance of the SQLVBChild child form. This new instance is a copy of SQLVBChild that has its own "life" once it is created and loaded. By making copies in this way, you can create multiple, independent versions of the SQLVBChild form to display various datasets.
You need to add another support routine. This one handles the loading of the scripts into the Windows Notepad for editing. This is called from the SQLVBMain MDI form. Create a Public Sub called LoadNotePadFile(cLoadMsg As String) and enter the code in Listing A.24.
Type.gifListing A.24. Coding the LoadNotePadFile routine.
Sub LoadNotePadFile(cLoadMsg As String, Optional strScript As String)
    '
    ' load notepad as an editor
    '
    On Error GoTo LoadNotePadFileErr:
    '
    Dim cEditFile As String
    Dim nAppID As Long
    '
    If IsMissing(strScript) = False And strScript <> "" Then
        cEditFile = strScript
    Else
continues

 
< previous page page_897 next page >

If you like this book, buy it!